﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Reflection;
using System.Collections;

using Optimization.Utilities;

namespace Optimization.Utilities
{

    /// <summary>
    /// Class for particle based method 
    /// </summary>
    public class Particle
    {
        /// <summary>
        /// Particle position
        /// </summary>
        public Vector Position;

        /// <summary>
        /// Particle velocity
        /// </summary>
        public Vector Velocity;

        /// <summary>
        /// Fittness function value at particle position
        /// </summary>
        public double Value;
    }


    /// <summary>
    /// Base class for particle oriented methods
    /// </summary>
    public class ParticleBasedMethod : List<Particle>
    {
        /// <summary>
        /// Function for creating problem
        /// <see cref="T:Func{T}"/>
        /// </summary>
        public Func<IProblem> ProblemFactory = null;

        /// <summary>
        /// Instance of problem class
        /// </summary>
        public IProblem Problem = null;

        /// <summary>
        /// Best known solution
        /// </summary>
        protected Vector Solution;

        /// <summary>
        /// Best known solution value }value of fitness function
        /// </summary>
        protected double SolutionValue;

        /// <summary>
        /// Injected/external solution. This allow cooperation of multiple methods.
        /// </summary>
        protected Vector externalSolution = null;

        /// <summary>
        /// Injected/external solutino value. This allow cooperation of multiple methods.
        /// </summary>
        protected double externalSolutionValue;
    }

    /// <summary>
    /// Interface for implementing debugger/logger. Not use now.
    /// </summary>
    public interface ParticleBasedMethodLogger
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="solver"></param>
        void Debug(ISolver solver);

        /// <summary>
        /// 
        /// </summary>
        void ResetDebugger();
    }


}
